<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Gadget>" %>

<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Web.Script.Serialization" %>
<%@ Import Namespace="EPiServer.Shell" %>
<%@ Import Namespace="EPiServer.Shell.Gadgets" %>
<%@ Import Namespace="EPiServer.Shell.Resources" %>
<%@ Import Namespace="EPiServer.Shell.UI.Views.Dashboard" %>
<%@ Import Namespace="EPiServer.Shell.Web.Mvc.Html" %>
<%@ Import Namespace="EPiServer.Shell.Web.Routing" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>iPhone Gadget</title>

    <link rel="Stylesheet" type="text/css" href="~/modules/iPhoneGadgetLib/Content/OverridingSite.css" />
    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/EPiJQuery.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Shell.js"></script>
    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Error.js"></script>
    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/ContextMenu.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/GlobalNavigation.js"></script>
    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/TabView.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Toolbar.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/ItemList.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Feedback.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/FoldOutPanel.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Pager.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Dialog.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Tooltip.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/CollapsiblePanel.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/jquery-1.5.5.validate.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/jquery.validate.localization.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/jquery.validate.custom.js"></script>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Search.js"></script>

    <link rel="stylesheet" type="text/css" href="<%= Paths.ToShellResource("ClientResources/Shell.css")%>" />
    <%= Page.ClientResources("Dashboard")%>
    <meta name="viewport" content="width=device-width,user-scalable=yes" />
    <!-- LightTheme -->
    <%= Page.ClientResources("DashboardLightTheme")%>
    <link rel="stylesheet" type="text/css" href="<%= Paths.ToShellResource("ClientResources/ShellLightTheme.css")%>" />
    <!--Client resources-->

    <script type="text/javascript" src="<%= Paths.ToShellResource("Resources/GetLocalizationResource?typeName=EPiServer.Shell.Resources.Texts&amp;culture=en")%>"></script>

    <script type="text/javascript" src="<%= Paths.ToShellResource("Resources/GetLocalizationResource?typeName=EPiServer.Shell.UI.Resources.DatePicker&amp;culture=en")%>"></script>

    <script type="text/javascript" src="<%= Paths.ToShellResource("Resources/GetLocalizationResource?typeName=EPiServer.Shell.UI.Resources.JQueryValidate&amp;culture=en")%>"></script>

    <!-- This need to be done after resource including since DatePicker does not have any code on background (controller etc.) -->

    <script type="text/javascript" src="<%= Paths.ToShellResource("ClientResources/EPi/Widgets/DatePicker/ui.datepicker.js")%>"></script>

    <script type="text/javascript" src="<%= Paths.ToShellResource("ClientResources/EPi/Widgets/DatePicker/ui.datepicker.localization.js")%>"></script>

<%--    <script type="text/javascript" src="<%= Paths.ToShellResource("ClientResources/Dashboard.js")%>"></script>--%>

  <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Dashboard.Manager.js"></script>
    <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Dashboard.Manager.Gadget.js"></script>
      <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Dashboard.Manager.Gadget.Move.js"></script>
        <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Dashboard.Manager.GadgetAdd.js"></script>
          <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Dashboard.Manager.TabView.js"></script>
       <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Gadget.js"></script>
       <script type="text/javascript" src="/modules/iPhoneGadgetLib/iPhoneInfo/Js/Autoupdate.js"></script>

    <!-- Register required client side resources for the requested gadget -->

    <script type="text/javascript" src="<%= Paths.ToShellResource("Resources/GetLocalizationResource?typeName=EPiServer.Shell.UI.Views.Dashboard.Resources&amp;culture=en")%>"></script>

    <% foreach (var resource in Model.Definition.ClientResourceDependencies)
       {%>
    <%= resource.ToHtmlResource() %>
    <%
        } 
    %>

</head>
<body>
    <div style="width: 100%; height: 100%;">
        <div class="epi-gadget" id="gadget_<%= Model.Id %>">
            <div class="epi-gadgetWindow">
          <% if (Model.Definition.Actions.Count != 0)
             { %>
             <ul id="epi-iphone-menu">
            <%foreach (GadgetAction action in Model.Definition.Actions)
              { %>
                                        <li>
                                           <%= Html.ViewLink(action.Text, action.Text, action.ActionName, null)%>
                                        </li>
                                        <%} %></ul>
                                        <% } %>
            
                    <div title="<%= Resources.GadgetLoaderTitleText %>" class="epi-gadgetFeedback">
                        &nbsp;</div>
               
                <div class="epi-gadgetContent">
                    <div class='epi-padding epi-contentGadgetLoader'>
                        <%=Resources.GadgetLoaderTitleText %>
                    </div>
                </div>
       

            <script type="text/javascript">
                 
	        //<![CDATA[
	        (function($) {
	            epi.shell.registerInitFunction(function() {
	            	         
                    epi.gadget.init({
                        id: "<%= Model.Id %>",
                        selector: "#gadget_<%= Model.Id %>",
                        contentUrl: '<%= Url.RouteUrl(new { moduleArea = Model.Definition.Area, controller = Model.Definition.ControllerName, action = Model.Definition.DefaultAction }) %>',
                        widgetParams: {
                            initMethod: '<%= Model.Definition.ClientScriptInitMethod ?? ""%>',
                            routeUrl: '<%= Server.UrlDecode(Url.RouteUrl(new { moduleArea = Model.Definition.Area, controller = Model.Definition.ControllerName, action = "{action}" })) %>',
                            routeParameters: <%= new JavaScriptSerializer().Serialize(new { action = Model.Definition.DefaultAction }) %>,
                            removeText: " ",
                            initMethodErrorText: ""
                        }
                    });
                });
	        } (epiJQuery));
	     
	        //remove delete in contextmenu
	          $('.epi-gadgetHeader h2').text(' ');
	          $('.epi-iconToolbar-delete').parent().html('');

	          
	          
	             //]]>
            </script>

        </div>
    </div>

    <script type="text/javascript" src="/modules/iPhoneGadgetLib/Content/InitiPhoneGadgets.js"></script>
  
</body>
</html>
